feat(python): add ContentCaptureMode for SDK-level content stripping#22
Draft
alexander-akhmetov wants to merge 1 commit intomainfrom
Draft
feat(python): add ContentCaptureMode for SDK-level content stripping#22alexander-akhmetov wants to merge 1 commit intomainfrom
alexander-akhmetov wants to merge 1 commit intomainfrom
Conversation
a02cff1 to
71e2cf2
Compare
71e2cf2 to
b0eba76
Compare
cfb9638 to
7a90384
Compare
Collaborator
Author
|
bugbot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7a90384. Configure here.
Add ContentCaptureMode support. Three modes control how much content is exported: FULL, NO_TOOL_CONTENT (default), and METADATA_ONLY. Supports config-level defaults, per-recording overrides, resolver callbacks, and ContextVar propagation to child tool executions.
7a90384 to
11235f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
Adds new content-capture/stripping paths that alter exported generation payloads, tool span attributes, and error reporting based on configuration and context; mistakes could lead to unexpected data leakage or over-redaction.
Overview
Introduces
ContentCaptureMode(client-, per-generation-, per-tool-, and context-level) to control whether user/tool content is exported and attached to OTel spans, including a new fail-closed resolver callback (ClientConfig.content_capture_resolver).When
METADATA_ONLYis effective, the SDK now stampssigil.sdk.content_capture_modeinto generation metadata, strips prompts/messages/tool schemas and tool-call/result payloads from generation exports, suppresses provider/mapping exception recording and span status messages, and also strips conversation ratingcommentbefore HTTP submission; validation logic is updated to accept structurally-present but empty text/thinking parts under the stripped marker.Adds context helpers (
with_content_capture_mode,content_capture_mode_from_context) with a stack mechanism so nested/overlapping generation recorders don’t clobber caller overrides, plus a comprehensivetest_content_capture.pycovering mode precedence, stripping, tool span behavior, backward compatibility withinclude_content, and rating comment stripping.Reviewed by Cursor Bugbot for commit 7a90384. Bugbot is set up for automated code reviews on this repo. Configure here.